<%@ page import="core.*, model.*, java.util.*" %>
<%@ include file='header.tpl.jsp'%>

<script src="js/check_answer.js" type="text/javascript"></script>

<form action="CheckAnswer" method="post">
<%ChoiceQuestion q = (ChoiceQuestion) request.getAttribute("question");%>
	<div class="box">
		<h2><%=q.getContent()%></h2>
		<ul class="options">
		<%String[] options = q.getOptions();%>
		<%if(q.getAnswer().length() == 1){%>
			<%for(int i : q.getRandomOptionKeys()){%>
				<li>
					<label>
						<input type="radio" id="id_<%=q.getQid()%>" name="id_<%=q.getQid()%>" value="<%=i%>" />
					<%=options[i]%>
					</label>
				</li>
			<%}%>
		<%}else{%>
			<%for(int i : q.getRandomOptionKeys()){%>
				<li>
					<input type="checkbox" id="id_<%=q.getQid()%>[<%=i%>]" name="id_<%=q.getQid()%>[<%=i%>]" />
					<label for="id_<%=q.getQid()%>[<%=i%>]"><%=options[i]%></label>
				</li>
			<%}%>
		<%}%>
		</ul>
	</div>

<div class="post_buttons">
	<button type="submit" onclick="postAnswer();setTimeout('location.reload()', 3000);return false;">Submit.. &amp; NEXT!</button>
</div>

</form>

<%@ include file='footer.tpl.jsp'%>